package system.base;

import com.hitrust.gs.lib.GSBaseConstants;

import framework.core.*;

/*
 Author    :chengbiao.he
 CreateTime:2008-02-14 08:38:58
 */
public class ProviderSearchEvent extends SearchEvent {

    private String m_id = ""; // all

    private String m_code = ""; // all

    private String m_name = ""; // all

    private String m_full_name = ""; // all

    private String m_eng_name = ""; // all

    private String m_com_property = ""; // all

    private String m_address = ""; // all

    private String m_zip_code = ""; // all

    private String m_manage_person = ""; // all

    private String m_manager_tel = ""; // all

    private String m_link_person = ""; // all

    private String m_link_tel = ""; // all

    private String m_country_code = ""; // all

    private String m_province_code = ""; // all

    private String m_district_code = ""; // all

    private String m_industry = ""; // all

    private String m_main_rpoduct = ""; // all

    private String m_scope = ""; // all

    private String m_credit_level = ""; // all

    private String m_is_tradeflat_provider = ""; // all

    private String m_status = ""; // all

    private String m_create_user_id = ""; // all

    private String m_create_user = ""; // all

    private String m_create_time = ""; // all

    private String m_last_update_user_id = ""; // all

    private String m_last_update_user = ""; // all

    private String m_last_update_time = ""; // all
    
    private String m_is_audit = "";
    
    private String m_is_one_category_provider="";

    public ProviderSearchEvent() {
        super();

        setOrderField(Provider.ID);

    }
    
    public String getIsOneCategoryProvider() {
		return m_is_one_category_provider;
	}

	public void setIsOneCategoryProvider(String m_is_one_category_provider) {
		this.m_is_one_category_provider = m_is_one_category_provider;
	}

	public String getId() {
        return m_id;
    }

    public void setId(String v) {
        m_id = v;
    }

    public String getCode() {
        return m_code;
    }

    public void setCode(String v) {
        m_code = v;
    }

    public String getName() {
        return m_name;
    }

    public void setName(String v) {
        m_name = v;
    }

    public String getFullName() {
        return m_full_name;
    }

    public void setFullName(String v) {
        m_full_name = v;
    }

    public String getEngName() {
        return m_eng_name;
    }

    public void setEngName(String v) {
        m_eng_name = v;
    }

    public String getComProperty() {
        return m_com_property;
    }

    public void setComProperty(String v) {
        m_com_property = v;
    }

    public String getAddress() {
        return m_address;
    }

    public void setAddress(String v) {
        m_address = v;
    }

    public String getZipCode() {
        return m_zip_code;
    }

    public void setZipCode(String v) {
        m_zip_code = v;
    }

    public String getManagePerson() {
        return m_manage_person;
    }

    public void setManagePerson(String v) {
        m_manage_person = v;
    }

    public String getManagerTel() {
        return m_manager_tel;
    }

    public void setManagerTel(String v) {
        m_manager_tel = v;
    }

    public String getLinkPerson() {
        return m_link_person;
    }

    public void setLinkPerson(String v) {
        m_link_person = v;
    }

    public String getLinkTel() {
        return m_link_tel;
    }

    public void setLinkTel(String v) {
        m_link_tel = v;
    }

    public String getCountryCode() {
        return m_country_code;
    }

    public void setCountryCode(String v) {
        m_country_code = v;
    }

    public String getProvinceCode() {
        return m_province_code;
    }

    public void setProvinceCode(String v) {
        m_province_code = v;
    }

    public String getDistrictCode() {
        return m_district_code;
    }

    public void setDistrictCode(String v) {
        m_district_code = v;
    }

    public String getIndustry() {
        return m_industry;
    }

    public void setIndustry(String v) {
        m_industry = v;
    }

    public String getMainRpoduct() {
        return m_main_rpoduct;
    }

    public void setMainRpoduct(String v) {
        m_main_rpoduct = v;
    }

    public String getScope() {
        return m_scope;
    }

    public void setScope(String v) {
        m_scope = v;
    }

    public String getCreditLevel() {
        return m_credit_level;
    }

    public void setCreditLevel(String v) {
        m_credit_level = v;
    }

    public String getIsTradeflatProvider() {
        return m_is_tradeflat_provider;
    }

    public void setIsTradeflatProvider(String v) {
        m_is_tradeflat_provider = v;
    }

    public String getStatus() {
        return m_status;
    }

    public void setStatus(String v) {
        m_status = v;
    }

    public String getCreateUserId() {
        return m_create_user_id;
    }

    public void setCreateUserId(String v) {
        m_create_user_id = v;
    }

    public String getCreateUser() {
        return m_create_user;
    }

    public void setCreateUser(String v) {
        m_create_user = v;
    }

    public String getCreateTime() {
        return m_create_time;
    }

    public void setCreateTime(String v) {
        m_create_time = v;
    }

    public String getLastUpdateUserId() {
        return m_last_update_user_id;
    }

    public void setLastUpdateUserId(String v) {
        m_last_update_user_id = v;
    }

    public String getLastUpdateUser() {
        return m_last_update_user;
    }

    public void setLastUpdateUser(String v) {
        m_last_update_user = v;
    }

    public String getLastUpdateTime() {
        return m_last_update_time;
    }

    public void setLastUpdateTime(String v) {
        m_last_update_time = v;
    }
    
    public String getIsAudit() {
    	return m_is_audit;
    }
    
    public void setIsAudit(String v) {
    	m_is_audit = v;
    }

    public String viewId() throws Exception {
        return Value.view(getId());
    }

    public String viewCode() throws Exception {
        return Value.view(getCode());
    }

    public String viewName() throws Exception {
        return Value.view(getName());
    }

    public String viewFullName() throws Exception {
        return Value.view(getFullName());
    }

    public String viewEngName() throws Exception {
        return Value.view(getEngName());
    }

    public String viewComProperty() throws Exception {
        return Value.view(getComProperty());
    }

    public String viewAddress() throws Exception {
        return Value.view(getAddress());
    }

    public String viewZipCode() throws Exception {
        return Value.view(getZipCode());
    }

    public String viewManagePerson() throws Exception {
        return Value.view(getManagePerson());
    }

    public String viewManagerTel() throws Exception {
        return Value.view(getManagerTel());
    }

    public String viewLinkPerson() throws Exception {
        return Value.view(getLinkPerson());
    }

    public String viewLinkTel() throws Exception {
        return Value.view(getLinkTel());
    }

    public String viewCountryCode() throws Exception {
        return Value.view(getCountryCode());
    }

    public String viewProvinceCode() throws Exception {
        return Value.view(getProvinceCode());
    }

    public String viewDistrictCode() throws Exception {
        return Value.view(getDistrictCode());
    }

    public String viewIndustry() throws Exception {
        return Value.view(getIndustry());
    }

    public String viewMainRpoduct() throws Exception {
        return Value.view(getMainRpoduct());
    }

    public String viewScope() throws Exception {
        return Value.view(getScope());
    }

    public String viewCreditLevel() throws Exception {
        return Value.view(getCreditLevel());
    }

    public String viewIsTradeflatProvider() throws Exception {
        return Value.view(getIsTradeflatProvider());
    }

    public String viewStatus() throws Exception {
        return Value.view(getStatus());
    }

    public String viewCreateUserId() throws Exception {
        return Value.view(getCreateUserId());
    }

    public String viewCreateUser() throws Exception {
        return Value.view(getCreateUser());
    }

    public String viewCreateTime() throws Exception {
        return Value.view(getCreateTime());
    }

    public String viewLastUpdateUserId() throws Exception {
        return Value.view(getLastUpdateUserId());
    }

    public String viewLastUpdateUser() throws Exception {
        return Value.view(getLastUpdateUser());
    }

    public String viewLastUpdateTime() throws Exception {
        return Value.view(getLastUpdateTime());
    }
    
    public String viewIsAudit() throws Exception {
    	return Value.view(getIsAudit());
    }

    public Conditions toConditions() throws Exception {
        Conditions c = super.toConditions();

        c.add(getCondition(Provider.ID, getId()));

        c.add(getCondition(Provider.CODE, getCode()));

        c.add(getCondition(Provider.NAME, getName()));

        c.add(getCondition(Provider.FULL_NAME, getFullName()));

        c.add(getCondition(Provider.ENG_NAME, getEngName()));

        c.add(getCondition(Provider.COM_PROPERTY, getComProperty()));

        c.add(getCondition(Provider.ADDRESS, getAddress()));

        c.add(getCondition(Provider.ZIP_CODE, getZipCode()));

        c.add(getCondition(Provider.MANAGE_PERSON, getManagePerson()));

        c.add(getCondition(Provider.MANAGER_TEL, getManagerTel()));

        c.add(getCondition(Provider.LINK_PERSON, getLinkPerson()));

        c.add(getCondition(Provider.LINK_TEL, getLinkTel()));

        c.add(getCondition(Provider.COUNTRY_CODE, getCountryCode()));

        c.add(getCondition(Provider.PROVINCE_CODE, getProvinceCode()));

        c.add(getCondition(Provider.DISTRICT_CODE, getDistrictCode()));

        c.add(getCondition(Provider.INDUSTRY, getIndustry()));

        c.add(getCondition(Provider.MAIN_RPODUCT, getMainRpoduct()));

        c.add(getCondition(Provider.SCOPE, getScope()));

        c.add(getCondition(Provider.CREDIT_LEVEL, getCreditLevel()));

        c.add(getCondition(Provider.IS_TRADEFLAT_PROVIDER, getIsTradeflatProvider()));

        c.add(getCondition(Provider.STATUS, getStatus()));

        c.add(getCondition(Provider.CREATE_USER_ID, getCreateUserId()));

        c.add(getCondition(Provider.CREATE_USER, getCreateUser()));

        c.add(getCondition(Provider.CREATE_TIME, getCreateTime()));

        c.add(getCondition(Provider.LAST_UPDATE_USER_ID, getLastUpdateUserId()));

        c.add(getCondition(Provider.LAST_UPDATE_USER, getLastUpdateUser()));

        c.add(getCondition(Provider.LAST_UPDATE_TIME, getLastUpdateTime()));
        
        if(getIsAudit() != null && ConstDefine.STR_YES.equals(getIsAudit())) {
        	c.add(" exists (select id from t_provider_type where status=1 and t_provider.id = t_provider_type.provider_id)");
        }
        
        if(getIsAudit() != null && ConstDefine.STR_NO.equals(getIsAudit())) {
        	c.add(" not exists (select id from t_provider_type where status =1 and t_provider.id = t_provider_type.provider_id)");
        }
        
        if(getIsOneCategoryProvider()!=null&& "1".equals(getIsOneCategoryProvider())){
        	c.add(" code in (select provider_code from t_product_type where status='1' and product_type='1' ) ");
        }
        if(getIsOneCategoryProvider()!=null&& "2".equals(getIsOneCategoryProvider())){
        	c.add(" code in (select provider_code from t_product_type where status='1' and product_type='2' ) ");
        }
        if(getIsOneCategoryProvider()!=null&& "3".equals(getIsOneCategoryProvider())){
        	c.add(" code in (select provider_code from t_product_type where status='1' and product_type='3' ) ");
        }
        if(getIsOneCategoryProvider()!=null&& "4".equals(getIsOneCategoryProvider())){
        	c.add(" code in (select provider_code from t_product_type where status='1' and product_type='4' ) ");
        }
        if(getIsOneCategoryProvider()!=null&& "5".equals(getIsOneCategoryProvider())){
        	c.add(" code in (select provider_code from t_product_type where status='1' and product_type='5' ) ");
        }
        if(getIsOneCategoryProvider()!=null&& "6".equals(getIsOneCategoryProvider())){
        	c.add(" code in (select provider_code from t_product_type where status='1' and product_type='6' ) ");
        }
        if(getIsOneCategoryProvider()!=null&& "7".equals(getIsOneCategoryProvider())){
        	c.add(" code in (select provider_code from t_product_type where status='1' and product_type='7' ) ");
        }
        if(getIsOneCategoryProvider()!=null&& "9".equals(getIsOneCategoryProvider())){
        	c.add(" code in (select provider_code from t_product_type where status='1' and product_type='9' ) ");
        }
        if(getIsOneCategoryProvider()!=null&& "10".equals(getIsOneCategoryProvider())){
        	c.add(" code in (select provider_code from t_product_type where status='1' and product_type='10' ) ");
        }
        if(getIsOneCategoryProvider()!=null&& "11".equals(getIsOneCategoryProvider())){
        	c.add(" code in (select provider_code from t_product_type where status='1' and product_type='11' ) ");
        }
        return c;
    }

    // add by chengbiao.he start

    // add by chengbiao.he end
}
